#!/bin/bash
echo "=================更新yum源=============="
echo "================备份原初始源============="
mkdir -p /etc/yum.repos.d/repo.backup
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/repo.backup
echo "=================拉取阿里源=============="
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
echo "=================重新加载源=============="
yum clean all
yum makecache
echo "=================安装Docker============="
echo "==============安装必要系统工具============"
yum install -y yum-utils
ehco "===============添加Docker源============="
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache
echo "==============安装Docker================"
yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
echo "==============启动Docker服务============="
service docker start
echo "============修改Docker守护进程==========="
vim /etc/docker/daemon.json
echo '{
   "registry-mirrors": [
    "https://o6w82na1.mirror.aliyuncs.com",
    "https://0c105db5188026850f80c001def654a0.mirror.swr.myhuaweicloud.com",
    "https://5tqw56kt.mirror.aliyuncs.com",
    "https://docker.1panel.live",
    "http://mirrors.ustc.edu.cn/",
    "http://mirror.azure.cn/",
    "https://hub.rat.dev/",
    "https://docker.ckyl.me/",
    "https://docker.chenby.cn",
    "https://docker.hpcloud.cloud",
    "https://docker.m.daocloud.io",
    "https://cf-workers-docker-io-4cg.pages.dev"
  ],
  "data-root": "/home/docker",
  "insecure-registries": ["http://10.100.200.105:8888","192.168.99.24:8081"],
  "storage-driver": "overlay2",
  "live-restore": false,
  "metrics-addr": "0.0.0.0:9323",
  "experimental": false,
  "exec-opts": ["native.cgroupdriver=systemd"]
}' > /etc/docker/daemon.json
echo "=============重启Docker服务=============="
systemctl daemon-reload
systemctl restart docker.service

